package com.bosi.exmple;

import com.bosi.exmple.chat.ChatWebServerSocket;
import com.bosi.exmple.chat.MessageCenter;
import com.bosi.exmple.chat.handler.OpenOrCloseHandler;
import com.bosi.exmple.chat.handler.PushHandler;
import com.bosi.exmple.chat.handler.TestHandler;
import com.bosi.exmple.message.MessageService;
import com.bosi.exmple.message.impl.SimpleMessageService;

/**
 * 聊天室示例
 */
public class ChatServer {

    public static void main(String[] args) {
        MessageService messageService = new SimpleMessageService();
        MessageCenter messageCenter = new MessageCenter();

        messageCenter.put("open",new OpenOrCloseHandler(messageService));
        messageCenter.put("push",new PushHandler(messageService));
        messageCenter.put("close",new OpenOrCloseHandler(messageService));
        messageCenter.put("test",new TestHandler(messageService));

       new ChatWebServerSocket(messageCenter).start(8080);
    }
}
